<?php
/**
 * Created by 陈俊伟.
 * User: Administrator
 * Date: 2019-10-28
 * Time: 下午 2:52
 */

namespace App\Lib\PHPExcel\ManuOrder;

use App\Lib\PHPExcel\ExcelHandle;

class TkRate extends ExcelHandle
{
    /*
     * 工厂模式
     * 普通厂家订单格式定制
     * */
    public function arrange($origin_arr)
    {

        $arr = [
            0 => [
                '手机号','收件人','头条号名称','完成金额', '总订单','完成订单',
                '退货订单','退款订单','备货中订单', '完成比例','退货比例','退款比例','最早订单',
                '最晚订单','店铺名称','最后一次收货地址'
            ]
        ];
        $i = 1;
        foreach ($origin_arr as $data) {
            $arr[$i]['手机号'] = $data['post_tel']; //店铺名称
            $arr[$i]['收件人'] = $data['post_receiver'];
            $arr[$i]['头条号名称'] = $data['nickname'];
            $arr[$i]['完成金额'] = $data['total_amount'] ?? "无";
            $arr[$i]['总订单'] = $data['order_num'] ?? "0";
            $arr[$i]['完成订单'] = $data['complete_order'] ?? "0";
            $arr[$i]['退货订单'] = $data['thdd'] ?? "0";
            $arr[$i]['退款订单'] = $data['tkdd'] ?? "0";
            $arr[$i]['备货中订单'] = $data['bhdd'] ?? "0";
            $arr[$i]['完成比例'] = $data['wc_rate'] ?? "0";
            $arr[$i]['退货比例'] = $data['th_rate'] ?? "0";
            $arr[$i]['退款比例'] = $data['tk_rate'] ?? "0";
            $arr[$i]['最早订单'] = $data['order_time_1'];
            $arr[$i]['最晚订单'] = $data['order_time_2'];

            $arr[$i]['店铺名称'] = $data['shops'];

            $arr[$i]['最后一次收货地址'] = $data['detail'];



            $i++;
        }

        return $arr;
    }


}